<template>
	<view class="content">
		<view class="ddd"><button open-type="contact" class="u-reset-button butt" style="width: 100%; height: 100%;">联系客服</button></view>
		<!-- <view class="info">
			<view class="info1" style="padding-top: 0;">
			
				<input type="text" value="" v-model="enter" placeholder="请设置您需要充值的金额" />
			</view>
		</view>
		<view class="list" style="padding-bottom: 26rpx;">
			<view class="list1">支付方式</view>
			<u-radio-group v-model="value" wrap @change="radioGroupChange">
				<u-radio
					@change="radioChange"
					v-for="(item, index) in list"
					:key="index"
					:name="item.name"
					:disabled="item.disabled"
					shape="square"
					active-color="#880000"
				>
					{{ item.name }}
				</u-radio>
			</u-radio-group>
		</view>
		<view class="needToPay" @click="rchg">
			<text class="txt1" v-if="enter">需支付 {{ enter }}</text>
			<text class="txt1" v-else>需支付</text>
		</view> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			uid: 0,
			enter: '',

			list: [
				{
					name: '微信',
					disabled: false,
				},
			],
			// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
			value: '微信',
			dd: '',
		};
	},
	onShow() {
		this.enter = '';
	},
	onLoad() {
		this.uid = getApp().globalData.uid;
	},
	methods: {
		radioChange(e) {
			//console.log('e :>> ', e);
		},

		radioGroupChange(e) {
			console.log(e);
		},
		async rchg() {
			var g = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
			if (!g.test(this.enter)) {
				return uni.$showMsg('输入金额不规范');
			}

			const res = await this.$u.post('api/wxpay/get_signature', {
				uid: getApp().globalData.uid,
				money: this.enter,
			});

			uni.requestPayment({
				provider: 'wxpay',
				timeStamp: res.timeStamp,
				nonceStr: res.nonceStr,
				package: res.package,
				signType: res.signType,
				paySign: res.paySign,
				success: function(res) {
					console.log('success:' + JSON.stringify(res));
				},
				fail: function(err) {
					console.log('fail:' + JSON.stringify(err));
				},
			});
		},
	},
};
</script>

<style lang="scss" scoped>
.content {
	
	.ddd {
		position: absolute;
		left: 50%;
		bottom: 150rpx;
		transform: translateX(-50%);
		width: 670rpx;
		height: 90rpx;
		background: #2a2929;
		border-radius: 10rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		color: #ffffff;
		font-size: 35rpx;
		justify-content: center;
		letter-spacing: 10rpx;
	}
	.butt {
		display: flex;
		align-items: center;
		justify-content: center;
	}
	width: 100vw;
	height: 100vh;
	background-color: #000000;
	padding: 24rpx 20rpx;
	.info {
		width: 710rpx;
		height: 163rpx;
		margin: 0 auto;
		background: #2a2929;
		border-radius: 15rpx;
		padding: 19rpx 16rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		.info1 {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			padding-top: 70rpx;

			.verificationCd {
				position: absolute;
				right: 0;
				top: 50%;
				transform: translateY(-50%);
				width: 120rpx;
				height: 48rpx;
				text-align: center;
				line-height: 48rpx;

				border: 1rpx solid #737373;
				border-radius: 6rpx;

				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #dcdcdc;
			}

			input {
				height: 50rpx;
				line-height: 70rpx;
				border-bottom: 1rpx solid #737373;
				color: #dcdcdc;
				padding: 0 2rpx;
				text-align: center;
			}
		}
	}

	.list {
		width: 710rpx;
		//height: 447rpx;
		margin: 0 auto;
		margin-top: 20rpx;
		background: #2a2929;
		border-radius: 15rpx;
		.list1 {
			height: 88rpx;
			padding: 26rpx 16rpx;

			font-size: 30rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #dcdcdc;

			border-bottom: 1rpx solid #737373;
		}
		/deep/.u-radio {
			height: 82rpx;
			padding: 0 17rpx;
			font-size: 26rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #dcdcdc;
			border-bottom: 1rpx solid #737373;
		}
		/deep/.u-radio__icon-wrap {
			margin-right: 16rpx;
		}
		/deep/ .u-radio__label {
			height: 25rpx;
			font-size: 26rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #dcdcdc;
			line-height: 25rpx;
		}
	}
	.needToPay {
		position: fixed;
		left: 50%;
		bottom: 37rpx;
		transform: translateX(-50%);
		display: flex;
		align-items: center;
		justify-content: center;
		width: 710rpx;
		height: 126rpx;
		background: #880000;
		border-radius: 15rpx;
		margin: 0 atuo;
		.txt1 {
			height: 37rpx;
			font-size: 38rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #ffffff;
			line-height: 37rpx;
			margin-right: 52rpx;
		}
		.txt2 {
			height: 24rpx;
			font-size: 24rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #ffffff;
			line-height: 24rpx;
		}
	}




}
</style>
